import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { GymVO, GymForm, GymQuery } from '@/api/primary/gym/types';

/**
 * 查询健身房信息列表
 * @param query
 * @returns {*}
 */

export const listGym = (query?: GymQuery): AxiosPromise<GymVO[]> => {
  return request({
    url: '/primary/gym/list',
    method: 'get',
    params: query
  });
};

export const listguize = (query?: GymQuery): AxiosPromise<GymVO[]> => {
  return request({
    url: '/primary/reservationSetting/list',
    method: 'get',
    params: query
  });
};
/**
 * 查询健身房信息详细
 * @param id
 */
export const getGym = (id: string | number): AxiosPromise<GymVO> => {
  return request({
    url: '/primary/gym/' + id,
    method: 'get'
  });
};

/**
 * 新增健身房信息
 * @param data
 */
export const addGym = (data: GymForm) => {
  return request({
    url: '/primary/gym',
    method: 'post',
    data: data
  });
};
/**
 * 新增健身房规则
 * @param data
 */
export const addguize = (data: any) => {
  return request({
    url: '/primary/reservationSetting',
    method: 'post',
    data: data
  });
};
/**
 * 修改健身房信息
 * @param data
 */
export const updateGym = (data: GymForm) => {
  return request({
    url: '/primary/gym',
    method: 'put',
    data: data
  });
};

/**
 * 删除健身房信息
 * @param id
 */
export const delGym = (id: string | number | Array<string | number>) => {
  return request({
    url: '/primary/gym/' + id,
    method: 'delete'
  });
};
